package me.zd.tool.hardlink.view.i18n;

import me.zd.tool.hardlink.view.I18nAdapter;

import javax.swing.*;

public class I18nAdapterFactory {

    public static I18nAdapter createAdapter(Object component, String...i18nKey) {
        if (component instanceof JButton) {
            return new I18nSingleTextComponentAdapter(((JButton) component)::setText, i18nKey);
        } else if (component instanceof JLabel) {
            return new I18nSingleTextComponentAdapter(((JLabel) component)::setText, i18nKey);
        } else if (component instanceof JFrame) {
            return new I18nSingleTextComponentAdapter(((JFrame) component)::setTitle, i18nKey);
        } else if (component instanceof JTabbedPane) {
            return new I18nTabbedPaneAdapter((JTabbedPane) component);
        } else if (component instanceof JCheckBox) {
            return new I18nSingleTextComponentAdapter(((JCheckBox) component)::setText, i18nKey);
        }
        return null;
    }

}
